package poi;

import java.io.File;
import java.io.FileOutputStream;

import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;


/**
 * 合并单元格
 * 
 * @author liu.r
 * @date 2017年4月6日 
 * @copyright liu.r 
 */
public class MergeXlsx {
	public static void main(String[] args) throws Exception {
		File file = new File("D://workspace/poi-test/src/main/java/resources/test.xlsx");
		FileOutputStream fos = new FileOutputStream(file);
		XSSFWorkbook wb = new XSSFWorkbook(); 
		XSSFSheet sheet = wb.createSheet();
		CellRangeAddress region = new CellRangeAddress(1, 7, 3, 6);
		sheet.addMergedRegion(region);
		wb.write(fos);
		fos.close();
	}
}
